﻿<!DOCTYPE html>
<!--隐患排查上报管理-外部检查内容管理-->
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
        <script src="/static/js/common.js"></script>

    <link href="/static/js/vue-treeselect/vue-treeselect.css" rel="stylesheet" />
    <script src="/static/js/vue-treeselect/vue-treeselect.js"></script>
    <script>

    </script>
    <style>
        .popupW100 .el-input-group__prepend {
        }
        .el-dialog__body {
            height: 100% !important;
        }

        .el-dialog.is-fullscreen {
            overflow: hidden !important;
        }
    </style>
    <style>
        .vue-treeselect__control {
            height: 100%;
            border: none;
            background: none;
        }

        .vue-treeselect__placeholder {
            top: -3px;
        }

        .vue-treeselect__single-value {
            top: -3px;
        }
    </style>
</head>
<body>
    <div id="app" v-cloak class="popupW100">
        <el-row>
            <el-col :span="24">
                <el-form label-position="right" ref="form" :inline="true" :model="formInline" class="demo-form-inline" style="margin-bottom: 15px;">
                    
                    <el-row>
                        <el-col class="head-tool">
                                
<div class="new_title fl"><strong><img src="/static/images/icon1.png" />外部检查内容管理列表</strong></div>

                            <span>
                                <btn :text="col.btnSelect" imgsrc="/static/images/search.png" linetype="3"
                                    @click="onSubmit"></btn>
                                
                                <btn-uploadfile-list url="xxxx" linetype="3"></btn-uploadfile-list>
                                <btn-export-list url="xxxx" :forminline="this.formInline" linetype="4"></btn-export-list>
                                <!-- <btn :text="col.btnDelete" linetype="4" @click="onDelete"></btn> -->
                            </span>
                        </el-col>
                    </el-row>
                    <el-row>


                        <el-col :xs="12" :sm="8" :md="6" :lg="6" :xl="6">
                            <div class="elst-select-mini">
                                <el-form-item>
                                    <el-input size="mini">
                                        <template slot="prepend">
                                            {{RisksManagement.ExternalInspection.RegionName+mark.m}}
                                        </template>
                                        <el-select @visible-change="visibleChange" v-model="formInline.model.RegionName" slot="suffix" :placeholder="RisksManagement.ExternalInspection.RegionName" @change="getNext($event)">
                                            <el-option label="请选择" value=""></el-option>
                                            <el-option v-for="item in RegionName" :label="item.label" :value="item.id"></el-option>
                                        </el-select>
                                    </el-input>
                                </el-form-item>
                            </div>
                        </el-col>
                        <el-col :xs="12" :sm="8" :md="6" :lg="6" :xl="6">
                            <div class="elst-select-mini">
                                <el-form-item>
                                    <el-input size="mini">
                                        <template slot="prepend">
                                            {{RisksManagement.ExternalInspection.RiskPosition+mark.m}}
                                        </template>
                                        <el-select @visible-change="visibleChange" v-model="formInline.model.RiskPosition" slot="suffix" :placeholder="RisksManagement.ExternalInspection.RiskPosition">
                                            <el-option label="请选择" value=""></el-option>
                                            <el-option v-for="item in RiskPosition" :label="item.label" :value="item.id"></el-option>
                                        </el-select>
                                    </el-input>
                                </el-form-item>
                            </div>
                        </el-col>

                        <el-col :xs="12" :sm="8" :md="6" :lg="6" :xl="6">
                            <div class="elst-select-mini">
                                <el-form-item>
                                    <el-input size="mini">
                                        <template slot="prepend">
                                            {{RisksManagement.ExternalInspection.OrganizationType+mark.m}}
                                        </template>
                                        <el-select @visible-change="visibleChange" v-model="formInline.model.OrganizationType" slot="suffix" :placeholder="RisksManagement.ExternalInspection.OrganizationType">
                                            <el-option label="请选择" value=""></el-option>
                                            <el-option v-for="item in OrganizationType" :label="item.value" :value="item.key"></el-option>
                                        </el-select>
                                    </el-input>
                                </el-form-item>
                            </div>
                        </el-col>



                        <!--<el-col :xs="8" :sm="8" :md="8" :lg="6" :xl="6">
        <div class="elst-select-mini">
            <el-form-item>
                <el-input v-model="formInline.model.InspectTime" :placeholder="RisksManagement.ExternalInspection.InspectTime" size="mini">
                    <template slot="prepend">
                        {{RisksManagement.ExternalInspection.InspectTime+mark.m}}
                    </template>
                </el-input>
            </el-form-item>
        </div>
    </el-col>-->


                        <el-col :xs="12" :sm="8" :md="6" :lg="6" :xl="6">
                            <div class="elst-select-mini">
                                <el-form-item>
                                    <el-input size="mini">
                                        <template slot="prepend">
                                            {{RisksManagement.ExternalInspection.InspectType+mark.m}}
                                        </template>
                                        <el-select @visible-change="visibleChange" v-model="formInline.model.InspectType" slot="suffix" :placeholder="RisksManagement.ExternalInspection.InspectType">
                                            <el-option label="请选择" value=""></el-option>
                                            <el-option v-for="item in InspectType" :label="item.value" :value="item.key"></el-option>
                                        </el-select>
                                    </el-input>
                                </el-form-item>
                            </div>
                        </el-col>


                        <el-col :xs="12" :sm="8" :md="6" :lg="6" :xl="6">
                            <div class="elst-select-mini">
                                <el-form-item>
                                    <el-input size="mini">
                                        <template slot="prepend">
                                            {{RisksManagement.ExternalInspection.RiskType+mark.m}}
                                        </template>
                                        <el-select @visible-change="visibleChange" v-model="formInline.model.RiskType" slot="suffix" :placeholder="RisksManagement.ExternalInspection.RiskType">
                                            <el-option label="请选择" value=""></el-option>
                                            <el-option v-for="item in RiskType" :label="item.value" :value="item.key"></el-option>
                                        </el-select>
                                    </el-input>
                                </el-form-item>
                            </div>
                        </el-col>


                        <el-col :xs="12" :sm="8" :md="6" :lg="6" :xl="6">
                            <div class="elst-select-mini">
                                <el-form-item>
                                    <el-input size="mini">
                                        <template slot="prepend">
                                            {{RisksManagement.ExternalInspection.RiskLevel+mark.m}}
                                        </template>
                                        <el-select @visible-change="visibleChange" v-model="formInline.model.RiskLevel" slot="suffix" :placeholder="RisksManagement.ExternalInspection.RiskLevel">
                                            <el-option label="请选择" value=""></el-option>
                                            <el-option v-for="item in RiskLevel" :label="item.value" :value="item.key"></el-option>
                                        </el-select>
                                    </el-input>
                                </el-form-item>
                            </div>
                        </el-col>

                        <el-col :xs="12" :sm="8" :md="6" :lg="6" :xl="6">
                            <div class="elst-select-mini">
                                <el-form-item>
                                    <el-input size="mini">
                                        <template slot="prepend">
                                            {{RisksManagement.ExternalInspection.InspectTime+'开始'+mark.m}}
                                        </template>
                                        <el-date-picker v-model="formInline.model.InspectTimeBegin"
                                                        type="date"
                                                        slot="suffix"
                                                        size="mini"
                                                        placeholder="选择日期">
                                        </el-date-picker>
                                    </el-input>
                                </el-form-item>
                            </div>
                        </el-col>
                        <el-col :xs="12" :sm="8" :md="6" :lg="6" :xl="6">
                            <div class="elst-select-mini">
                                <el-form-item>
                                    <el-input size="mini">
                                        <template slot="prepend">
                                            {{RisksManagement.ExternalInspection.InspectTime+'结束'+mark.m}}
                                        </template>
                                        <el-date-picker v-model="formInline.model.InspectTimeEnd"
                                                        type="date"
                                                        slot="suffix"
                                                        size="mini"
                                                        placeholder="选择日期">
                                        </el-date-picker>
                                    </el-input>
                                </el-form-item>
                            </div>
                        </el-col>

                        <el-col :xs="12" :sm="8" :md="6" :lg="6" :xl="6">
                            <div class="elst-select-mini">
                                <el-form-item>
                                    <el-input size="mini">
                                        <template slot="prepend">
                                            {{RisksManagement.ExternalInspection.RectificationLeading+mark.m}}
                                        </template>
                                        <treeselect v-model="formInline.model.RectificationLeading" :options="RectificationLeading" :flat="true"
                                                    :show-count="true" :disable-branch-nodes="true" slot="suffix" placeholder="请选择"
                                                    style="line-height: 28px;width:50%;float: right;" />

                                    </el-input>
                                </el-form-item>
                            </div>
                        </el-col>
                

                    </el-row>
                </el-form>

                <el-table stripe ref="table" :data="ListItem.tableData"
                          :height="ListItem.tableHeight"
                          border @selection-change="handleSelectionChange" row-style="height:10px"
                          style="width: 100%">
                    <el-table-column type="selection" align="center" width="55">
                    </el-table-column>
                    <el-table-column type="index" show-overflow-tooltip="true" :label="RisksManagement.ExternalInspection.id" :index="indexMethod" width="50"></el-table-column>
                    <el-table-column prop="troubleNum" :formatter="getDicValue" min-width="130"
                    show-overflow-tooltip="true" :label="RisksManagement.RiskReport.troubleNum">
                    </el-table-column>
                    <el-table-column prop="InstitutionTypes"
                                     min-width="100"
                                     show-overflow-tooltip="true"
                                     :label="RisksManagement.ExternalInspection.InstitutionTypes">
                    </el-table-column>
                    <el-table-column prop="CompanyName"
                                     min-width="100"
                                     show-overflow-tooltip="true"
                                     :label="RisksManagement.ExternalInspection.CompanyName">
                    </el-table-column>
                    <el-table-column prop="RiskDescription"
                                     min-width="200"
                                     show-overflow-tooltip="true"
                                     :label="RisksManagement.ExternalInspection.RiskDescription">
                    </el-table-column>
                    <el-table-column prop="RegionName"
                                     :formatter="getDicValue"
                                     min-width="100"
                                     show-overflow-tooltip="true"
                                     :label="RisksManagement.ExternalInspection.RegionName">
                    </el-table-column>
                    <el-table-column prop="RiskPosition"
                                     :formatter="getDicValue"
                                     min-width="100"
                                     show-overflow-tooltip="true"
                                     :label="RisksManagement.ExternalInspection.RiskPosition">
                    </el-table-column>
                    <el-table-column prop="OrganizationType"
                                     :formatter="getDicValue"
                                     min-width="100"
                                     show-overflow-tooltip="true"
                                     :label="RisksManagement.ExternalInspection.OrganizationType">
                    </el-table-column>
                    <el-table-column prop="InspectTime"
                                     min-width="180"
                                     show-overflow-tooltip="true"
                                     :label="RisksManagement.ExternalInspection.InspectTime">
                    </el-table-column>
                    <el-table-column prop="InspectType"
                                     :formatter="getDicValue"
                                     min-width="100"
                                     show-overflow-tooltip="true"
                                     :label="RisksManagement.ExternalInspection.InspectType">
                    </el-table-column>
                    <el-table-column prop="RiskType"
                                     :formatter="getDicValue"
                                     min-width="100"
                                     show-overflow-tooltip="true"
                                     :label="RisksManagement.ExternalInspection.RiskType">
                    </el-table-column>
                    <el-table-column prop="RiskLevel"
                                     :formatter="getDicValue"
                                     min-width="100"
                                     show-overflow-tooltip="true"
                                     :label="RisksManagement.ExternalInspection.RiskLevel">
                    </el-table-column>
                    <el-table-column prop="RectificationLeading"
                                     :formatter="getDicValue"
                                     min-width="100"
                                     show-overflow-tooltip="true"
                                     :label="RisksManagement.ExternalInspection.RectificationLeading">
                    </el-table-column>

                    <el-table-column width="53" prop="update" :label="col.btnUpdate" fixed="right">
                        <template slot-scope="scope">
                            <button type="button" class="elst-bt-xg" @click=UserInput('xg',scope.row.id)>
                                <i class="el-icon-edit"></i>
                            </button>
                        </template>
                    </el-table-column>

                </el-table>
                <el-row type="flex" justify="end">


                    <el-pagination ref="page" @size-change="handleSizeChange"
                                   @current-change="handleCurrentChange"
                                   :current-page="ListItem.currentPage"
                                   :page-sizes="ListItem.pagesizes"
                                   :page-size="ListItem.pagesize"
                                   :layout="ListItem.layout"
                                   :total="ListItem.total">
                    </el-pagination>

                </el-row>
            </el-col>
        </el-row>
        <el-dialog :title="dialogTitle" :visible.sync="ListItem.dialogVisible" @close='closeDialog' width="80%" height="80%" top="10vh" fullscreen="true">
            <iframe ref="iframe" :src="ListItem.InputUrl" style="height:95%;width:100%" frameborder="0"></iframe>
        </el-dialog>
    </div>
    <script type="text/javascript">
        Vue.component('treeselect', VueTreeselect.Treeselect)
        app = new Vue({
            el: '#app',

            data: function () {
                return {
                    dialogTitle: '外部机构导入内容',
                    //页面内左树
                    mydata: PersonInChargeTree,
                    Region: myTree,
                    RegionName: [],
                    RiskPosition: [],
                    RiskLevel: [],
                    RiskType: [],
                    OrganizationType: [],
                    InspectType: [],
                    RectificationLeading: [],
                    //页面内数据初始化
                    ListItem: ListItem,
                    formInline: {
                        model: {
                            RegionName: '',
                            RiskPosition: '',
                            OrganizationType: '',
                            InspectTimeBegin: '',
                            InspectTimeEnd:'',
                            InspectType: '',
                            RiskType: '',
                            RiskLevel: '',
                            RectificationLeading: null,
                        },
                        offset: 0,
                        limit: 10
                    }
                }
            },
            created: function () {
                var currApp = this;
                window.onresize = function () {
                    currApp.ListItem.tableHeight = window.innerHeight -
                        currApp.$refs.table.$el.offsetTop - 60;
                    if (currApp.ListItem.tableHeight < 112) {
                        currApp.ListItem.tableHeight = 112;
                    }
                }
            },
            mounted: function () {
                //获取下拉菜单内容
                this.RiskLevel = getDicData('03');//字典内容
                this.InspectType = getDicData('101');
                this.RiskType = getDicData('100');
                this.OrganizationType = getDicData("103")
                this.RectificationLeading = fn(this.mydata, "0");
                this.RegionName = fn(this.Region, "0");
                //初始化数据
                this.GetPageData(1);
                //列表高度自适应
                tablehigh(this);
                //this.TreeData = fn(this.mydata, "0");
            },
            methods: {
                //解決edge下select bug
                visibleChange: function (isVisible) {
                    visibleChange(isVisible)
                },
                //表格序号连续化
                indexMethod: function (index) { return (this.ListItem.currentPage - 1) * this.ListItem.pagesize + index + 1; },
                getDicValue: function (row, column, cellValue, index) {
                    switch (column.property) {

                        case "OrganizationType":
                            return getDicValue('103', cellValue)
                            break;
                        case "InspectType":
                            return getDicValue('101', cellValue)
                            break;
                        case "RiskType":
                            return getDicValue('100', cellValue)
                            break;
                        case "ReportType":
                            return getDicValue('102', cellValue)
                            break;
                        case "RiskLevel":
                            return getDicValue('03', cellValue)
                            break;
                        case "RegionName":
                            return getTreeValue(this.Region, cellValue); break;
                        case "RiskPosition":
                            return getTreeValue(this.Region, cellValue); break;
                        case "RectificationLeading":
                            return getTreeValue(this.mydata, cellValue); break;
                        default:
                            return cellValue; break;
                    }

                },
                //二级联动
                getNext: function (prov) {
                    this.RiskPosition = [];
                    this.formInline.model.RiskPosition = '';
                    this.RiskPosition = fn(this.Region, prov);

                },

                handleNodeClick: function (data) {
                    //当前节点如果为最底层的才触发新的查询?暂时先这么处理,如果每层节点都查询就把判断去掉,并在接口逻辑模糊查询
                    if (!data.children) {
                        this.formInline.model.TreeNode = data.id
                        onSubmit(this);
                    }

                },
                closeDialog: function () { closeDialog(this); },
                //删除方法
                onDelete: function () { onDelete(this, '/api/ExternalInspection/DeleteMuti'); },
                //列表选择触发
                handleSelectionChange: function (val) { handleSelectionChange(this, val); },
                //Dialog展示
                UserInput: function (val, id) { DialogShow(this, val, "ExternalInspectionInput.html", id); },
                //获取分页数据
                GetPageData: function (currentIndex) { GetPageData(this, currentIndex, '/api/ExternalInspection/GetList') },
                //查询方法
                onSubmit: function () { onSubmit(this); },
                //pagesize改变 触发方法
                handleSizeChange: function (val) { handleSizeChange(this, val); },
                //跳页触发方法
                handleCurrentChange: function (val) { handleCurrentChange(this, val); }
            }
        });

    </script>
</body>

</html>
